<?php
class Login_Model_Pagedecision implements Login_Model_Mainable{
    
    private $action_handler;
    
    public function main(array $variables = null) {
        switch($variables['get']['page']){
            case 'zaloguj-sie':
                return $this->login_action($variables);
                break;
            case 'zarejestruj-sie':
                return $this->registred_action($variables);
                break;
            case 'przypomnij-haslo':
                return $this->forgot_password($variables);
                break;
            default :
                return $this->default_action($variables);
                break;
        }
    }
    
    private function forgot_password(array $variables = null){
        $this->action_handler = new Login_Model_Forgotaction;
        return $this->action_handler->main($variables);
    }
    
    private function registred_action(array $variables = null){
        $this->action_handler = new Login_Model_Registred;
        return $this->action_handler->main($variables);
    }
    
    private function login_action(array $variables = null){
        $this->action_handler = new Login_Model_Loginaction;
        return $this->action_handler->main($variables);
    }
    
    private function default_action(array $variables = null){
        unset($variables);
        $this->action_handler = new Login_Model_Login;
        return $this->action_handler->main($variables);
    }

}
